<template>
  <div>
    账号：{{username}}
    <br/>
    <br/>
    密码：<i-input type="password" v-model="password" placeholder="请输入密码" style="width: 300px"></i-input>
    <br/>
    <br/>
    <i-button type="info"  @click="handleAddManager">修改</i-button>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'ManagerUpdate',
  data () {
    return {
      username:this.$store.state.manager.username,
      password:''
    }
  },
  methods: {
    handleAddManager(){
      alert(this.$store.state.manager.username);
      if(this.jianyan()){
        axios.post('/web/api/manager/edit',{"username":this.username,"password":this.password}).then(this.handleAddInfoSucc)
      }
    },
    handleAddInfoSucc (res) {
      var data = res.data
      console.log('tag',data)
      this.$Message.success(data.message)
    },
    jianyan(){
      if(this.username === ''){
        this.$Message.success("请输入账号");
        return false;
      }else if(this.password === ''){
        this.$Message.success("请输入密码");
        return false;
      }else{
        return true
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
.toback {
    width: 100%;
    font-size: 1.8rem;
    line-height: 2.6;
    background #358ff0
    p {
      text-align: center;
      color: #ffffff;
    }
}
</style>

